package com.ywu.application.spi.spi;

import com.ywu.application.spi.dto.*;
import com.ywu.application.spi.entity.ApiRouterEntity;
import com.ywu.application.spi.entity.TenantEntity;
import com.ywu.application.spi.entity.UserEntity;
import com.ywu.application.spi.entity.YwuAppEntity;
import com.ywu.common.result.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author YWU
 * @date 2025/10/13
 */
@FeignClient(value = "YWU-APPLICATION")
public interface YwuApplicationSpi {
    // ADMIN-USER
    @PostMapping("/ywu/admin/user/query.user.account.info")
    CommonResult<UserEntity> queryUserByUserAccount(@RequestBody UserDto userDto);

    @PostMapping("/ywu/admin/user/query.user.by.id.batch.spi")
    CommonResult<List<UserEntity>> queryUserByUserIdBatch(@RequestBody List<Integer> ids);

    // ROLE
    @PostMapping("/ywu/role/auth/user.role.info")
    CommonResult<Object> queryUserRoleInfo(@RequestBody UserRoleAuthDto userRoleAuthDto);

    @PostMapping("/ywu/role/auth/api.role.info")
    CommonResult<Object> queryApiRoleInfo(@RequestBody ApiRoleAuthDto apiRoleAuthDto);

    @PostMapping("/ywu/role/auth/user.role.auth.delete.info")
    CommonResult<Object> userRoleAuthDeleteInfo(@RequestBody List<UserRoleAuthDto> userRoleAuthDtos);

    @PostMapping("/ywu/role/auth/menu.role.auth.delete.info")
    CommonResult<Object> menuRoleAuthDeleteInfo(@RequestBody MenuRoleAuthDto menuRoleAuthDto);

    @PostMapping("/ywu/role/auth/api.role.auth.delete.info")
    CommonResult<Object> apiRoleAuthDeleteInfo(@RequestBody ApiRoleAuthDto apiRoleAuthDto);

    // API
    @PostMapping("/ywu/api/router.add.info")
    CommonResult<Object> add(@RequestBody ApiRouterDto apiRouterDto);

    @PostMapping("/ywu/api/api.route.info")
    CommonResult<Object> apiRouteInfoQuery(@RequestBody ApiRouterDto apiRouterDto);

    @PostMapping("/ywu/api/api.route.info.for.spi")
    CommonResult<ApiRouterEntity> apiRouteInfoQueryForSpi(@RequestBody ApiRouterDto apiRouterDto);

    @PostMapping("/ywu/api/api.route.query.all.routes.spi")
    CommonResult<List<ApiRouterEntity>> queryAllRoutesSpi();

    @PostMapping("/ywu/api/api.query.by.code.for.spi")
    CommonResult<List<ApiRouterEntity>> queryApiByCode(@RequestBody List<ApiRouterDto> apiRouterDto);


    // TENANT
    @PostMapping("/ywu/tenant/tenant.info.by.user.id.spi")
    CommonResult<List<TenantEntity>> queryTenantInfoByUserId(@RequestBody TenantUserDTO tenantUserDTO);

    @PostMapping("/ywu/tenant/tenant.info.by.tenant.id.spi")
    CommonResult<TenantEntity> queryTenantInfoByTenantId(@RequestBody TenantDto tenantDto);

    @PostMapping("/ywu/tenant/tenant.info.delete.by.user.id.for.spi")
    CommonResult<Object> deleteTenantPermission(@RequestBody TenantUserDTO tenantUserDTO);

    // APP-MANAGE
    @PostMapping("/ywu/app/app.user.query.by.user.spi")
    CommonResult<List<YwuAppEntity>> queryAppInfoByUser(@RequestBody YwuAppUserDto ywuAppUserDto);

    @PostMapping("/ywu/app/app.user.query.by.app.id")
    CommonResult<List<YwuAppEntity>> queryAppInfoByAppId(@RequestBody List<YwuAppUserDto> ywuAppUserDtoList);

    @PostMapping("/ywu/app/app.token.check.info.for.spi")
    CommonResult<Object> checkAppToken(@RequestBody YwuAppDto dto);

    @PostMapping("/ywu/app/user/app.user.delete.info.by.user.id.for.spi")
    CommonResult<Object> appUserDeleteInfoByUserId(@RequestBody YwuAppUserDto ywuAppUserDto);
}
